unit fmCust;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Mask, DB, ADODB, MSAccess, OLEDBAccess, OLEDBC, OLEDBIntf, DBAccess, MemDS, cxGraphics, cxControls,
  cxLookAndFeels, cxLookAndFeelPainters, cxStyles, dxSkinsCore,
  dxSkinsDefaultPainters, dxSkinscxPCPainter, cxCustomData, cxFilter,
  cxData, cxDataStorage, cxEdit, cxDBData, cxGridCustomTableView,
  cxGridTableView, cxGridDBTableView, cxGridLevel, cxClasses,
  cxGridCustomView, cxGrid, cxDBLookupComboBox, cxCheckBox, dxPSGlbl,
  dxPSUtl, dxPSEngn, dxPrnPg, dxBkgnd, dxWrap, dxPrnDev, dxPSCompsProvider,
  dxPSFillPatterns, dxPSEdgePatterns, dxPSPDFExportCore, dxPSPDFExport,
  cxDrawTextUtils, dxPSPrVwStd, dxPSPrVwAdv, dxPSPrVwRibbon,
  dxPScxEditorProducers, dxPScxExtEditorProducers,
  dxPScxPageControlProducer, dxPSCore, dxPScxCommon, dxPScxGrid6Lnk,
  cxCurrencyEdit;


type
  TCustForm = class(TForm)
    grpCust: TGroupBox;
    medtCustNo: TMaskEdit;
    lblCust: TLabel;
    btnQuery: TButton;
    srcCust: TDataSource;
    tvCust: TcxGridDBTableView;
    glCust: TcxGridLevel;
    cxGrid1: TcxGrid;
    tvCustAccountNo: TcxGridDBColumn;
    tvCustNetID: TcxGridDBColumn;
    tvCustAccountName: TcxGridDBColumn;
    tvCustRoadNo: TcxGridDBColumn;
    tvCustBalance: TcxGridDBColumn;
    tvCustStaus: TcxGridDBColumn;
    tvCustAccountType: TcxGridDBColumn;
    adsRoad: TMSQuery;
    srcRoad: TDataSource;
    btnPrint: TButton;
    dxComponentPrinter: TdxComponentPrinter;
    dxComponentPrinterLink: TdxGridReportLink;
    tblcardType: TMSTable;
    srcCardType: TDataSource;
    tvCustAlterCash: TcxGridDBColumn;
    tblCust: TMSTable;
    procedure btnQueryClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure btnPrintClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  CustForm: TCustForm;

implementation

uses
  fmMain;

{$R *.dfm}

procedure TCustForm.btnQueryClick(Sender: TObject);
var
  vCustNo, vStatus: string;
begin
   if Trim(medtCustNo.Text) <> '' then
      vCustNo := 'AccountNo=' + Trim(medtCustNo.Text)
   else
      vCustNo := '';


   tblCust.Close;
   tblCust.Filtered  := True;
   tblCust.FilterSQL := vCustNo;
   tblCust.Open;
end;

procedure TCustForm.FormCreate(Sender: TObject);
begin
   adsRoad.Open;
   tblcardType.Open;
end;

procedure TCustForm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
   tblCust.Close;
   adsRoad.Close;
   tblcardType.Close;
   Action := caFree;
end;

procedure TCustForm.btnPrintClick(Sender: TObject);
begin
   dxComponentPrinter.Preview(True);
end;

end.
